package com.brainhealth.customer.config;

import com.brainhealth.common.constant.PunctuationConstants;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import io.minio.MinioClient;
import org.springframework.stereotype.Component;

/**
 * Minio 配置信息
 *
 * @author wolong
 */


@Data
@Component
@Configuration
public class MinioConfig
{
    /**
     * 服务地址
     */
    @Value(value = "${minio.aliyunOSS}")
    private String aliyunOSS;
    /**
     * 服务地址
     */
    @Value(value = "${minio.aliyunQingZhuOSS}")
    private String aliyunQingZhuOSS;
    /**
     * 服务地址
     */
    @Value(value = "${minio.url}")
    private String url;

    /**
     * 服务地址
     */
    @Value(value = "${minio.ip}")
    private String ip;

    /**
     * 用户名
     */
    @Value(value = "${minio.access-key}")
    private String accessKey;

    /**
     * 密码
     */
    @Value(value = "${minio.secret-key}")
    private String secretKey;

    /**
     * 存储桶名称
     */
    @Value(value = "${minio.bucket-name}")
    private String bucketName;

    public static final String PATH_QING_ZHU_VOICE="qingzhu/voice";

    public static final String PATH_EXERCISE_VIDEO="exercise/video";

    /**
     * 获取青竹语音父级地址
     * https://anxd2.oss-cn-shanghai.aliyuncs.com/qingzhu/voice/category1/11_1.WAV
     * @return
     */
    public String getQingZhuVoiceParentPath()
    {
        String path= aliyunQingZhuOSS.concat(PunctuationConstants.SLASH)
                .concat(PATH_QING_ZHU_VOICE)
                .concat(PunctuationConstants.SLASH);
        return path;
    }

    /**
     * 获取青竹语音父级地址
     * http://139.196.227.56:9000/anxd/qingzhu/voice/category1/11_1.WAV
     * @return
     */
    public String getQingZhuVoiceParentPathMinio()
    {
        String path= url.concat(PunctuationConstants.SLASH)
                .concat(bucketName)
                .concat(PunctuationConstants.SLASH)
                .concat(PATH_QING_ZHU_VOICE)
                .concat(PunctuationConstants.SLASH);
        return path;
    }

    /**
     * 获取会员训练资源地址路径
     * @return
     */
    public String getExerciseVideoPath()
    {
        String path = url.concat(PunctuationConstants.SLASH)
                .concat(bucketName)
                .concat(PunctuationConstants.SLASH)
                .concat(PATH_EXERCISE_VIDEO)
                .concat(PunctuationConstants.SLASH);
        return path;
    }
}
